<?php
if (null !== $this->grid) {
	/* @var $grid KontorX_DataGrid */
	$grid = $this->grid;
	/* @var $adapter KontorX_DataGrid_Adapter_DbTableTree */
	$adapter = $grid->getAdapter();
	
	$adapter->getSelect()->where('locale = ?', $this->urlParams('locale', Zend_Locale::getDefault()));
	
	/* @var $rowset KontorX_Db_Table_Tree_Rowset_Abstract */
	$rowset = $adapter->getIterator();

	$r = new KontorX_Iterator_Reiterate_IteratorIterator($rowset, RecursiveIteratorIterator::SELF_FIRST);
	$a = $r->iterate(new Promotor_Iterator_Reiterate_Container_JsTreeArray());
	print $this->json($a->getArrayCopy());
}